# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-pure-sasl
pkgver=0.6.2
pkgrel=6
pkgdesc="Pure Python client SASL implementation"
url="https://github.com/thobbs/pure-sasl"
license=('MIT')
arch=('any')
depends=('python')
makedepends=('python-setuptools')
optdepends=('python-kerberos: for GSSAPI support')
checkdepends=('python-nose' 'python-pykerberos' 'python-six')
source=("https://github.com/thobbs/pure-sasl/archive/$pkgver/$pkgname-$pkgver.tar.gz"
        $pkgname-drop-mock.patch::https://github.com/thobbs/pure-sasl/pull/42.patch)
sha512sums=('e4ac40822014dec0522faf25f0806cd5cb1053fa7c5362fd3569f79f43ac775aa1a7895421699d36713e0493ebfc7215da0bca9fee516e07b4ef1e182684d4bb'
            '4a5899744c8e34899d9790e778f94aa60730186912a4818bbd6f93b708c684ad7ef1e1f11823e2b8a92a756dc65a6e50587fcaee7022bac3d0a2f3c962bafade')

prepare() {
  cd pure-sasl-$pkgver
  sed -i 's/mock<=1.0.1/mock/' test-requirements.txt
  patch -p1 -i ../$pkgname-drop-mock.patch
}

build() {
  cd pure-sasl-$pkgver
  python setup.py build
}

check() {
  cd pure-sasl-$pkgver
  nosetests3
}

package() {
  cd pure-sasl-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
